<template>
    <div class="app-film-item-v">
        <div class="content-box" v-for="filmitem in filmitems" :key="filmitem.id">
            <div class="img-box">
                <img :src="filmitem.img" :alt="filmitem.nm">
                <div class="wish">
                    <span class="sum">
                        {{ filmitem.wish }}
                    </span>
                    人想看
                </div>
            </div>
            <div class="film-info">
                <h5 class="title">{{ filmitem.nm }}</h5>
                <p class="date">{{ filmitem.comingTitle }}</p>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    data () {
        return {
            filmitems: []
        }
    },
    created () {
        this.$ajax.get('/my/mostExpected?ci=1&limit=10&offset=0&token=')
            .then(results => {
                 if (results.status === 200) {
                    console.log('获取数据成功...');
                    this.filmitems = results.data.coming;
                    this.filmitems.forEach(element => {
                        element.comingTitle = element.comingTitle.slice(0,-3);
                        element.img = element.img.replace(/w.h/,'170.230');
                    });
                    // console.log(this.filmitems);
                } else {
                    console.log('发生未知错误，获取数据失败...');
                }
                // console.log(this.filmitems);
            })
            .catch(err => {
                console.log(err);
            });
    }
}
</script>

<style lang="scss">
.app-film-item-v {
    height: auto;

    .content-box {
        display: inline-block;
        width: 2.266666rem;
        height: auto;
        overflow: hidden;
        margin-right: .266666rem;

        .img-box {
            width: 2.266667rem;
            height: 3.066667rem;
            position: relative;

            .wish {
                position: absolute;
                left: .106667rem;
                bottom: .053333rem;
                color: #faaf00;
                font-size: .293333rem;
                font-weight: 600;
                width: auto;
                height: auto;
            }
        }

        .film-info {
            height: auto;

            .title {
                margin: 0 0 .08rem;
                font-size: .346667rem;
                color: #222;
                font-weight: bold;
            }

            .date {
                margin: 0;
                font-size: .32rem;
                color: #999;
            }
        }
    }
}
</style>
